package com.sh.service.store;

import com.sh.common.exception.BizException;
import com.sh.entity.Bucket;
import com.sh.entity.ObjectItem;
import com.sh.pojo.bo.CopyObjectsBO;
import com.sh.pojo.dto.ResourceTreeDTO;
import com.sh.pojo.vo.DownLoadObjectVO;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.zip.ZipOutputStream;

public interface IOSService {

    List<Bucket> listBuckets();

    List<String> listAllObjects(String bucket, String folder);

    /**
     * 根据根路径检索所有
     */
    List<ObjectItem> listObjects(String bucketName, String prefix) throws BizException;

    List<ObjectItem> listObjects(String bucketName, String prefix, String keyword) throws BizException;

//    /**
//     * 检索具体路径下的对象
//     * */
//    List<ObjectItem> listObjectsByPath(String bucket,String prefix);

    InputStream getObject(String bucketName, String prefix) throws BizException;

    String signUrl(String bucketName, String objectName, Integer expires);

    void putObject(String bucketName, String objectName, MultipartFile file) throws BizException;

    List<String> getFirstFolder(String bucketName) throws BizException;

    List<ResourceTreeDTO> listDirectories(String bucketName, String prefix, int currentDepth, int maxDepth);

    void createFolder(String bucket, String path) throws BizException;

    void deleteObject(String bucket, String objectName) throws BizException;

    void deleteFolder(String bucket, String folderPath) throws BizException;

    void deleteObjects(String bucket, List<String> objectKeys) throws BizException;

    void renameObject(String bucket, String originalObjectKey, String newObjectKey) throws BizException;

    void renameFolder(String bucket, String oldFolder, String newFolder) throws BizException;

    void copyObject(String bucket, String originalObjectKey, String newObjectKey) throws BizException;

    void copyObjects(CopyObjectsBO bo);

    List<DownLoadObjectVO> signUrls(String bucket, List<String> objectKeys, Integer expirationInMillis, String localPath);

    List<DownLoadObjectVO> downloadObjects(String bucket, List<String> objectsPath, Integer expire, String downloadPath) throws BizException;

    void downloadAndZipObjects(String bucket, String remoteFolder, ZipOutputStream zos) throws IOException;
}
